//
//  PayOkViewController.m
//  MagazineShangejie
//
//  Created by cnbizMedia on 15/11/18.
//  Copyright © 2015年 CnbizMedia. All rights reserved.
//

#import "PayOkViewController.h"
#import "SettingTableViewController.h"
@interface PayOkViewController ()

@end

@implementation PayOkViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"支付结果";
    //    self.hidesBottomBarWhenPushed = YES;
    
    //自定义bar按钮
    UIButton *buttonf=[UIButton buttonWithType:UIButtonTypeCustom];
    [buttonf setFrame:CGRectMake(0, 0, 40, 30)];
    [buttonf addTarget:self action:@selector(popOfDismss) forControlEvents:UIControlEventTouchUpInside];
    //    [buttonf setImage:[UIImage imageNamed:@"dismiss"] forState:UIControlStateNormal];
    [buttonf setTitle:@"完成" forState:UIControlStateNormal];
    [buttonf setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
   
    UIBarButtonItem*leftBarItem = [[UIBarButtonItem alloc]initWithCustomView:buttonf];
    self.navigationItem.rightBarButtonItem=leftBarItem;
    
    
    //添加返回手势
    UISwipeGestureRecognizer *recognizer = [[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(popOfDismss)];
    [recognizer setDirection:(UISwipeGestureRecognizerDirectionRight)];
    [[self view] addGestureRecognizer:recognizer];
    
    
   
}

- (void)popOfDismss{
    
////
//    UIStoryboard*story=[UIStoryboard storyboardWithName:@"Main" bundle:nil];
//    SettingTableViewController *choo=[story instantiateViewControllerWithIdentifier:@"SettingTableViewController"];
//    //        opin.view.backgroundColor=[UIColor colorWithWhite:0.890 alpha:1.000];
//    //        [opin opinionInWWW:1];
//    [self.navigationController pushViewController:choo animated:YES];

    
        if ([[self.navigationController viewControllers] count]>=2) {
            //        self.hidesBottomBarWhenPushed = NO;
//            [self.navigationController popViewControllerAnimated:YES];
            [self.navigationController popToRootViewControllerAnimated:YES];
    
        }else{
            //    self.hidesBottomBarWhenPushed = NO;
            [self dismissViewControllerAnimated:YES completion:nil];
        }
}

- (IBAction)cellPhone:(id)sender {
     [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel://023-88739152"]];
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
